#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QDialog* dialog =  new QDialog(this);
    // 设置对话框的尺寸
    dialog->resize(200, 100);
    // 通过 show 方法就可以显示出对话框
    dialog->show();

    dialog->setAttribute(Qt::WA_DeleteOnClose);
}

